#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

using namespace std;

int main()
{
    string a, b;
    while (cin >> a >> b)
    {
        int p = 0;
        for (int j = 0; j < a.size(); j++)
        {
            if (a[j] > a[p])
                p = j;
        }
        cout << a.substr(0, p + 1) << b << a.substr(p + 1) << endl;
    }
    return 0;
}
